<template>
  <el-drawer
    :visible.sync="drawerVisible"
    :wrapper-closable="true"
    :close-on-press-escape="false"
    :size="1000"
    title="卡片视图预览"
    with-header
    append-to-body
    show-close
    class="card-preview-container"
    @close="handleClose"
  >
    <CardList v-model="cardConfigsData" value-key="defaultValue"/>
  </el-drawer>
</template>

<script>
import CardList from './cardList';
export default {
  components: { CardList },
  props: {},
  data() {
    return {
      drawerVisible: false,
      cardConfigsData: {}
    };
  },
  methods: {
    open(data) {
      this.cardConfigsData = data;
      this.drawerVisible = true;
    },
    handleClose() {
      this.drawerVisible = false;
    }
  }
};
</script>

<style lang="scss" scoped>
.card-preview-container {
  &::v-deep {
    .el-drawer__header {
      height: 48px;
      padding: 0 10px;
      margin: 0;
      box-shadow: 2px 4px 5px 0 rgba(221,225,234,0.3);
      > span {
        font-size: 16px;
        color: #333;
      }
    }
    .el-drawer__body {
      overflow: auto !important;
      padding: 10px;
      @include scrollBar($x: auto, $y: auto, $width: 12px);
    }
  }
  .close-btn {
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    z-index: 10;
  }
}
</style>
